<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/static/common/taglibs.jsp"%>

<div class="page">
	<div class="pageContent">

		<form method="post" action="${ctx}${baseMapping }/save"
			class="pageForm required-validate"
			onsubmit="return validateCallback(this, dialogAjaxDone)">
			<input type="hidden" name="id" value="${user.id}" />
			<div class="pageFormContent" layoutH="68">
				<fieldset id="user_base_info">
					<legend>用户基本信息</legend>
					<dl>
						<dt>登录名:</dt>
						<dd>
							<input type="text" name="loginName" size="15" id="loginName"
								class="required" value="${user.loginName}" />
						</dd>
					</dl>
					<dl>
						<dt>用户名:</dt>
						<dd>
							<input type="text" id="name" name="name" size="15"
								class="required" value="${user.name}" />
						</dd>
					</dl>

					<c:if test="${user.id<1}">
						<dl>
							<dt>密码:</dt>
							<dd>
								<input type="password" id="password" name="password" size="15"
									class="required" value="${user.password}" />
							</dd>
						</dl>
						<dl>
							<dt>确认密码:</dt>
							<dd>
								<input type="password" id="passwordConfirm"
									name="passwordConfirm" size="15" class="required" value="" />
							</dd>
						</dl>
					</c:if>
				</fieldset>

				<fieldset style="width: 280px; float: left;">
					<legend>所属角色:</legend>
					<c:forEach items="${allRoles }" var="role">
						<label for="role_${role.id }"><input type="checkbox"
							name="roleIds" id="role_${role.id }" value="${role.id }"
							<c:if test="${fn:contains(user.roleIds,role.id)}">checked="checked"</c:if> />
							${role.name }</label>
					</c:forEach>
				</fieldset>

			</div>
			<div class="formBar">
				<shiro:hasPermission name="user:edit">
					<ul>
						<li><div class="buttonActive">
								<div class="buttonContent">
									<button type="submit" id="btn" class="btn">提交</button>
								</div>
							</div></li>
						<li><div class="button">
								<div class="buttonContent">
									<button type="button" class="close">取消</button>
								</div>
							</div></li>
					</ul>
				</shiro:hasPermission>
			</div>
		</form>
	</div>
</div>

